<include file="public:header"/>

<div class="toptit">添加顾问</div>
<form action="{:U('add')}" method="post" name="FormData" id="FormData" enctype="multipart/form-data">
    <div class="form_main width120">
        <div class="fl">姓名:</div>
        <div class="fr">
            <input name="name" type="text" class="input_text_default middle" maxlength="25" value=""/>
        </div>
        <div class="fl">手机:</div>
        <div class="fr">
            <input name="mobile" type="text" class="input_text_default middle" maxlength="11" value="" onKeyUp="if(event.keyCode !=37 && event.keyCode != 39) value=value.replace(/\D/g,'');"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))"/>
        </div>
        <div class="fl">电话:</div>
        <div class="fr">
            <input name="tel" type="text" class="input_text_default middle" maxlength="15" value=""/>
        </div>
        <div class="fl">QQ:</div>
        <div class="fr">
            <input name="qq" type="text" class="input_text_default middle" maxlength="15" value="" onKeyUp="if(event.keyCode !=37 && event.keyCode != 39) value=value.replace(/\D/g,'');"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))"/>
        </div>
        <div class="fl">照片:</div>
        <div class="fr J-file-input-box">
            <div class="file-input-src hid">
                <div class="img"></div>
                <div class="del file-input-del" id="" name="pic">点击更换</div>
            </div>
            <div class="file-input-block" id="J_upload_cos_img" name="pic"><span class="o-txt">上传</span>照片</div>
            <input type="hidden" class="file-input-save-name" name="pic" value="">
        </div>
        <notempty name="apply['Subsite']">
            <div class="fl">所属分站:</div>
            <qscms:subsite 列表名="subsite_list"/>
            <div class="fr txt">
                <if condition="$visitor['role_id'] eq 1">
                    <volist name="subsite_list" id="subsite">
                        <label style="color: rgb(102, 102, 102);">
                            <input name="subsite_id[]" type="checkbox" value="{$subsite.s_id}" <if condition="$i eq 1">checked="checked"</if>>{$subsite.s_sitename}
                        </label>&nbsp;&nbsp;&nbsp;
                    </volist>
                    <else/>
                    <volist name="subsite_list" id="subsite">
                        <if condition="in_array($subsite['s_id'],$visitor['subsite'])">
                            <label style="color: rgb(102, 102, 102);">
                                <input name="subsite_id[]" type="checkbox" value="{$subsite.s_id}" <if condition="$i eq 1">checked="checked"</if>>{$subsite.s_sitename}
                            </label>&nbsp;&nbsp;&nbsp;
                        </if>
                    </volist>
                </if>
            </div>
        </notempty>
        <div class="fl"></div>
        <div class="fr">
            <input type="submit" class="admin_submit" value="保存"/>
            <input type="button" class="admin_submit" value="返回" onClick="history.go(-1)"/>
        </div>
        <div class="clear"></div>
    </div>
</form>

</div>
<include file="public:footer"/>
</body>
<script type="text/javascript">
  var uploadUrl = "{:U('Upload/form_upload')}";
</script>
<script src="__ADMINPUBLIC__/js/ajaxfileupload.js"></script>
<script src="__ADMINPUBLIC__/js/fileupload.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
      // 上传网站首页Logo
      $.upload('#J_upload_cos_img',{name:'pic',dir:'consultant'},function(result){
        if(result.error == 1){
          var htmlResult = '<img src="'+ result.url.src +'" align=absmiddle>';
          $('#J_upload_cos_img').closest('.J-file-input-box').find('.file-input-src .img').html(htmlResult);
          $('#J_upload_cos_img').closest('.J-file-input-box').find('.file-input-save-name').val(result.url.savename);
          if ($('#J_upload_cos_img').hasClass('file-input-block')) {
            $('#J_upload_cos_img').closest('.J-file-input-box').find('.file-input-src').removeClass('hid');
            var $delObj = $('#J_upload_cos_img').closest('.J-file-input-box').find('.file-input-del');
            $('#J_upload_cos_img').remove();
            $delObj.attr('id', "J_upload_cos_img_change_btn");
            $.upload('#J_upload_cos_img_change_btn',{name:'pic',dir:'consultant'},function(result){
              if(result.error == 1){
                var htmlResult = '<img src="'+ result.url.src +'" align=absmiddle>';
                $('#J_upload_cos_img_change_btn').closest('.J-file-input-box').find('.file-input-src .img').html(htmlResult);
                $('#J_upload_cos_img_change_btn').closest('.J-file-input-box').find('.file-input-save-name').val(result.url.savename);
              } else {
                disapperTooltip("remind", "上传失败："+result.message);
              }
            })
          }
        } else {
          disapperTooltip("remind", "上传失败："+result.message);
        }
      });
    });
</script>
</html>